You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
708 B
33 lines
708 B
import { notFound } from "next/navigation";
|
|
import { isLocale, localeDirections, locales } from "@/translations/config";
|
|
import { I18nProvider } from "@/translations/provider";
|
|
|
|
export function generateStaticParams() {
|
|
return locales.map((lang) => ({ lang }));
|
|
}
|
|
|
|
export default async function LocaleLayout({
|
|
children,
|
|
params,
|
|
}: {
|
|
children: React.ReactNode;
|
|
params: Promise<{ lang: string }>;
|
|
}) {
|
|
const { lang } = await params;
|
|
|
|
if (!isLocale(lang)) {
|
|
notFound();
|
|
}
|
|
|
|
return (
|
|
<I18nProvider locale={lang}>
|
|
<div
|
|
dir={localeDirections[lang]}
|
|
data-lang={lang}
|
|
className={`lang-${lang}`}
|
|
>
|
|
{children}
|
|
</div>
|
|
</I18nProvider>
|
|
);
|
|
}
|